import React, { useState, useEffect } from 'react'
import { Breadcrumb, Button, Modal } from "antd"
import { SearchOutlined, CloudUploadOutlined } from '@ant-design/icons';
import * as echarts from 'echarts';
import style from '../index.module.scss'


export default function Echarts2() {
    const [echarts2, setMain] = useState('')
    const option = {
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data: ['实名认证用户数', '绑卡用户数']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: ['1-28', '1-30', '2-1', '2-3', '2-5', '2-7', '2-9', '2-11', '2-13', '2-15']
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                name: '实名认证用户数',
                type: 'line',
                stack: 'Total',
                data: [1100,1050,1201,900,380,370,390,375,376,400]
                
            },
            {
                name: '绑卡用户数',
                type: 'line',
                stack: 'Total',
                data: [1040,1030,1200,920,400,390,370,399,389,379]
            }
        ]
    };
    useEffect(() => {
        var node = document.getElementById('echarts2')
        setMain(node)
    }, [])
    // 基于准备好的dom，初始化echarts实例
    if (echarts2 !== "") {
        var myChart = echarts.init(echarts2);
        myChart.resize({ height: '400px' })
        myChart.setOption(option);
    }
    return (
        <div>
            <div>
                <div className={style.pre_title}>
                    <p>新增注册用户数</p>
                    <Button className='button'><CloudUploadOutlined className="icon" />导出</Button>
                </div>
                <div id="echarts2"></div>
            </div>
        </div>
    )
}
